package com.rran.study.chat.server.accept;

import com.rran.study.chat.server.core.annotations.Accept;
import com.rran.study.chat.server.core.annotations.AcceptMapping;
import com.rran.study.chat.server.dto.request.AddMemberToGroupMsg;
import com.rran.study.chat.server.dto.request.CreateGroupMsg;
import com.rran.study.chat.server.dto.Response;
import com.rran.study.chat.server.service.GroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * @author yy
 * @Type GroupAccept.java
 * @Desc
 * @date 2020/8/9 16:16
 */
@Accept
@Component
@AcceptMapping(value = "/group")
public class GroupAccept {

    @Autowired
    private GroupService groupService;

    /**
     * 创建群聊
     * @param msg
     */
    @AcceptMapping(value = "/create")
    public Response create(CreateGroupMsg msg) {
        return groupService.createGroup(msg);
    }

    /**
     * 加入群成员
     * @param msg
     * @return
     */
    @AcceptMapping(value = "/addMember")
    public Response addMember(AddMemberToGroupMsg msg){
        return groupService.addMember(msg);
    }

}
